package controller;

import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.example.promax.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Slf4j
@Controller


public class usercontroller {
    @RequestMapping(value="/index")

    public String index(){
        log.info("index被访问");
        return "forward:index.html";
    }


    @RequestMapping(value="/login")

    public String login(){
        log.info("跳转登录界面");
        return "forward:login.html";
    }

    @Autowired
    private LoginService loginService;
    @RequestMapping(value="/userlogin",params = {"username","password"})
    public String userlogin(){
        String username =null;
        String password = null;
        if(loginService.login(username,password)){
            return "forward:index.html";
        }else {
        return "forward:login.html";
        }
    }
}
